<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>怀旧版后台管理系统</title>
    <link href="/static/admin/css/default.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/easyui1.8.6/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/easyui1.8.6/themes/icon.css" />
    <script type="text/javascript" src="/static/admin/easyui1.8.6/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/easyui1.8.6/jquery.easyui.min.js"></script>
    <style>
        body{background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);}
        a{text-decoration:none;color:black;}
        form div{
            margin-bottom:20px;
        }
    </style>

</head>
<body>
<div style="margin:0 auto;width:800px;">
    <div id="win" class="easyui-window" minimizable="false" maximizable="false"  collapsible="false"  title="账号登录" style="width:400px;">
        <form method="post" style="padding:30px" id="ff">
            <div>
                <input class="easyui-textbox" name="username" data-options="iconCls:'icon-man',prompt:'账号'" style="width:100%">
            </div>
            <div>
                <input class="easyui-textbox" name="password" data-options="iconCls:'icon-lock',type:'password'" style="width:100%">
            </div>
            <!--
            <p>验证码: <input class="easyui-validatebox" type="text" id="n" name="ckcode" required="true" style="width:80px;"/><img src="images/loading.gif" width="108" height="30"/></p>
            -->
            <div style="padding:5px;text-align:center;">
                <a href="javascript:;" class="easyui-linkbutton" icon="icon-clear" onclick="document.login_f.reset()">重置</a>
                <a href="javascript:login();" class="easyui-linkbutton" icon="icon-ok">登录</a>
            </div>
        </form>
    </div>
</div>

</body>
<script>
    function login(){
        $.ajax({
            url:"{:url('admin/user/login')}",
            method:'post',
            data:$('#ff').serialize(),
            success:function (res){
                if(res.code==0){
                    $.messager.show({title:'提示',msg:res.message,timeout:3000,showType:'slide'});
                    setTimeout(function (){
                        window.location.href = "{:url('admin/Index/index')}";
                    },3000)
                } else {
                    $.messager.show({title:'提示',msg:res.message,timeout:2000,showType:'slide'});
                    $('#ff').form('reset');
                }
            }
        });
    }
</script>
</html>
